<?php include_once './application/views/sys_admin/common/header.php';  ?>

<?php if(isset($admin['type_id']) && $admin['type_id'] !=1){?>
<h3 style="color:red">对不起，权限不足</h3>
<?php }else{?>
<div class=" definewidth m20">
		<form  class="form-inline definewidth m20">
			<button type="button" class="btn btn-success"  onclick="href('/sys_admin/systemadmin/add_view/');" >添加</button>
	  	</form>
		<table class="table table-bordered table-hover definewidth m10">
			 <thead>
			    <tr>
			      <th><strong>ID</strong></th>
					<th><strong>用户名</strong></th>
					<th><strong>管理类型</strong></th>
					<th><strong>注册时间</strong></th>
					<th><strong>状态</strong></th>
					<?php if($admin['type_id'] == 1){?>	
					<th><strong>操作</strong></th>
					<?php }?>
			    </tr>
			   </thead>
			 <?php foreach($user_list as $info){?>
			  <tr>
				<td><?php echo $info['id'];?></td>
				<td><?php echo $info['adminname'];?></td>
				<td>
				<?php
				foreach($admintype as $v){
					if($info['type_id']==$v['id']) echo $v['name'];
				}
				?>
				</td>
				<td><?php echo date('Y-m-d H:i',$info['addtime']);?></td>
				<td><?php echo $info['status']==1?"开通":"关闭";?></td>
				<?php if($admin['type_id'] ==1){?>	
				<td><a href="/sys_admin/systemadmin/edit_view/<?php echo $info['id'];?>">修改 | <a href="javascript:if(confirm('确定删除？')){remove(<?php echo $info['id'];?>);}">删除</a></a> </td>
				<?php }?>
			  </tr>
			  <?php }?>
			  	<tr>
			  	<td colspan="12"  class="invbd_page"><?php echo $this->pagination->create_links();?></td>
			  	</tr>
		</table>
</div>
<?php }?>

<script>
function remove(id){
	$.ajax({
		type: "post",
		url: "/sys_admin/systemadmin/admin_user_del/",
		data: "id="+id,
		success: function(msg){
			$("#dialog" ).dialog();
			if(msg == 1){
				$("#msg").html("删除成功！");
				$("#row_"+id).hide();
			}else{
				$("#msg").html("删除失败，请联系管理员！");
			}
			setTimeout(function(){
				$("#dialog" ).dialog("close");
			},3000);
		},
		dataType: "text"
	});
}
</script>
<div id="dialog" title="系统提示" style="display:none"><p id="msg" style="text-align:center"></p></div>
